package cn.com.sgcc.dlt698.util;

public class ProtocolData {
    int offset = 0;

    String s;

    public ProtocolData(String str) {
        s = str;
    }

    public String readStr(int len) {
        String v = s.substring(offset, offset + len);
        offset += len;

        return v;
    }

    public int readInt(int len) {
        String v = readStr(len);
        return (int) Long.parseLong(v, 16);
    }

    public long readUInt(int len) {
        String v = readStr(len);
        return Long.parseLong(v, 16);
    }

    public short readShort() {
        String v = readStr(4);
        return (short) Long.parseLong(v, 16);
    }
}
